<?php
@define ( 'IN_ADMIN', TRUE );
define ( 'D_BUG', false );

D_BUG ? error_reporting ( 7 ) : error_reporting ( 0 );
set_magic_quotes_runtime ( 0 );

$_SGLOBAL = $_SCONFIG = $_TPL = $_SCOOKIE = array ();

// 程序目录
define ( 'S_ROOT', dirname ( __FILE__ ) . DIRECTORY_SEPARATOR );
// 基本文件
if (! @include_once (S_ROOT . './config.php')) {
	exit ( "Template file : config.php Not found!" );
}
include_once (S_ROOT . './source/function_common.php');

// 时间
$mtime = explode ( ' ', microtime () );
$_SGLOBAL ['timestamp'] = $mtime [1];
$_SGLOBAL ['supe_starttime'] = $_SGLOBAL ['timestamp'] + $mtime [0];

// GPC过滤
$magic_quote = get_magic_quotes_gpc ();
if (empty ( $magic_quote )) {
	$_GET = saddslashes ( $_GET );
	$_POST = saddslashes ( $_POST );
}
// 初始化
$_SGLOBAL ['supe_uid'] = 0;
$_SGLOBAL ['supe_username'] = '';
$_SGLOBAL ['refer'] = empty ( $_SERVER ['HTTP_REFERER'] ) ? '' : $_SERVER ['HTTP_REFERER'];
$_SGLOBAL ['adminuids'] = array();

// 处理REQUEST_URI
if (! isset ( $_SERVER ['REQUEST_URI'] )) {
	$_SERVER ['REQUEST_URI'] = $_SERVER ['PHP_SELF'];
	if (isset ( $_SERVER ['QUERY_STRING'] ))
		$_SERVER ['REQUEST_URI'] .= '?' . $_SERVER ['QUERY_STRING'];
}
if ($_SERVER ['REQUEST_URI']) {
	$temp = urldecode ( $_SERVER ['REQUEST_URI'] );
	if (strexists ( $temp, '<' ) || strexists ( $temp, '"' )) {
		$_GET = shtmlspecialchars ( $_GET ); // XSS
	}
}
// 启用session
$lifeTime = 24 * 3600;  // 保存一天
session_set_cookie_params($lifeTime);
session_start();
//判断用户登录状态
checkauth();
$_SGLOBAL['uhash'] = md5($_SGLOBAL['supe_uid']."\t".substr($_SGLOBAL['timestamp'], 0, 6));
?>